<?php session_start(); ?>

<?php
if (empty($_SESSION['username'])) : // if member is not logged in
    header('Location: /');
    ?> 

<?php elseif ($_SESSION['username'] == 'admin') : // if the admin logs in  ?>

    <div id="top" class="menu">
        <div class="container">
        
        <div class="lblock">
            <ul>
                <li><a href="statistics.php">Statistics</a></li>
                <li><a href="globalSettings.php">Global Settings</a></li>
            </ul>
        </div>

        <div class="rblock">
            <form action="login.php" method="post">
                <ul>
                    <li><?php echo $_SESSION['username']; ?></li>
                    <li><input type="submit" value="log out" /></li>
                    <input type="hidden" name="func" value="logout" />
                </ul>
            </form>
        </div>
        
        <div class="clear"></div>
        </div>
    </div>

<?php else : // if member is logged in  ?> 

    <div id="top" class="menu">
        <div class="container">
        <div class="lblock">
            <ul>
                <li><a href="home.php">Home</a></li>
                <li><a href="games.php">Games</a></li>
                <li><a href="players.php">Players</a></li>
                <li><a href="createGame.php">Create Game</a></li>
                <li><a href="myGames.php">My Games</a></li>
                <li><a href="friends.php">Friends</a></li>
            </ul>
        </div>

        <div class="rblock">
            <form action="login.php" method="post">
                <ul>
                    <li><?php echo $_SESSION['username']; ?></li>
                    <li><a href="settings.php">Settings</a></li>
                    <li><input type="submit" value="log out" /></li>
                    <input type="hidden" name="func" value="logout" />
                </ul>
            </form>
        </div>
        </div>
        
        <div class="clear"></div>
        
    </div>

<?php endif; ?>
